package MINA.minaServ.MyEncode;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

/**
 * Created by kz on 2017/5/12.
 */
public class MyfilterFactory implements ProtocolCodecFactory {
//    private MyDecoder decoder;
    private MyCumulativeDecoder decoder;
    private MyEncoder encoder;

    public MyfilterFactory() {
//        decoder = new MyDecoder();
        decoder = new MyCumulativeDecoder();
        encoder = new MyEncoder();
    }

    @Override
    public ProtocolEncoder getEncoder(IoSession ioSession) throws Exception {
        return encoder;
    }

    @Override
    public ProtocolDecoder getDecoder(IoSession ioSession) throws Exception {
        return decoder;
    }
}
